package encription;

import java.security.PublicKey;
import java.util.Vector;

import packets.client.PublicKeyPair;

/**
 * stores the public keys that are banned for usage
 */
public class CertificateRevocationList {
	private Vector<PublicKey> _crl;
	
	/**
	 * Creates an instance {@link CertificateRevocationList}
	 */
	public CertificateRevocationList(){
		_crl = new Vector<PublicKey>();
	}
	/**
	 * adds a pair of keys to the CRL (each of them, separately)
	 * @param pk keys to add to the CRL
	 */
	public void addPublicKey(PublicKeyPair pk){
		_crl.add(pk.getSigkey());
		_crl.add(pk.getEncryptionKey());
	}
	/**
	 * checks if a {@link PublicKey} is not in the CRL
	 * @param pk the key to check
	 * @return true if the key is not in the CRL
	 */
	public boolean isLegal(PublicKey pk){
		return (!_crl.contains(pk));
	}
}
